import java.util.Arrays;

public class Test05 {
  public static void main(String[] args) {
    // System.out.println("Hello Test05!");
    // int[] array = { 1, 2, 3, 4, 5 };
    int[] array = { 5, 5 };
    double avg = getAvg(array);
    System.out.println("该数组的平均值是：" + avg);
  }

  public static double getAvg(int[] arr) {
    double avg = 0.0;
    // 遍历数组，求和
    int sum = 0;
    for (int i = 0; i < arr.length; i++) {
      sum += arr[i];
    }
    // 元素和 除以 数组长度
    int num = arr.length;
    avg = sum / num;
    return avg;
  }
}